import request from '@/utils/request'

// export function getList(parentId) {
//   return request({
//     url: `/categories/${parentId}`,
//     method: 'get'
//   })
// }

export function getCategory(id) {
  return request({
    url: `/categories/${id}`,
    method: 'get'
  })
}

export function createCategory(data) {
  return request({
    url: '/categories/add-new',
    method: 'post',
    data
  })
}

export function updateCategory(id, data) {
  return request({
    url: `/categories/${id}/update`,
    method: 'post',
    data
  })
}

export function deleteCategory(id) {
  return request({
    url: `/categories/${id}/delete`,
    method: 'post'
  })
}

export function enableCategory(id) {
  return request({
    url: `/categories/${id}/enable`,
    method: 'post'
  })
}

export function disableCategory(id) {
  return request({
    url: `/categories/${id}/disable`,
    method: 'post'
  })
}

export function displayCategory(id) {
  return request({
    url: `/categories/${id}/display`,
    method: 'post'
  })
}

export function hideCategory(id) {
  return request({
    url: `/categories/${id}/hidden`,
    method: 'post'
  })
}

export function queryByParentId(parentId) {
  return request({
    url: `/categories/${parentId}/children`,
    method: 'get'
  })
}

export function queryBeandByCategory(id) {
  return request({
    url: `/categories/${id}/brands`,
    method: 'get'
  })
}

export function queryAttributeTemplateByCategory(id) {
  return request({
    url: `/categories/${id}/attribute-templates`,
    method: 'get'
  })
}

